# Podfile 开头
source 'https://github.com/CocoaPods/Specs.git'

ENV['HERMES_ENGINE_TARBALL'] = '0'  # 禁用 Hermes 预构建包，优先源码构建

require_relative '../node_modules/react-native/scripts/react_native_pods'

platform :ios, '16.0'
prepare_react_native_project!

#linkage = ENV['USE_FRAMEWORKS']
#if linkage
#  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
#  use_frameworks! linkage.to_sym
#end

inhibit_all_warnings!

target 'Eason_20250526_ReactNative' do
  config = use_native_modules!
  
  use_react_native!(
    :path => config[:reactNativePath],
    :app_path => "#{Pod::Config.instance.installation_root}/..",
    :hermes_enabled => false # 显式启用 Hermes，确保与 ENV 配置一致
  )
                    
                    pod 'react-native-safe-area-context', :path => '../node_modules/react-native-safe-area-context'
                    pod 'react-native-compressor', :path => '../node_modules/react-native-compressor', :modular_headers => true
                    pod 'React-jsc', :path => '../node_modules/react-native/ReactCommon/jsc', :modular_headers => true
                    post_install do |installer|
                      installer.pods_project.targets.each do |target|
                        next unless target.respond_to?(:build_configurations)
                        target.build_configurations.each do |config|
                          config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
                          # 针对某个 Pod 单独配置
                          
                          config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
                          config.build_settings['GENERATE_MODULEMAP_FILE'] = 'YES'
                          config.build_settings['CLANG_CXX_LANGUAGE_STANDARD'] = 'c++17'
                          config.build_settings['CLANG_CXX_LIBRARY'] = 'libc++'
                          config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['']
                          config.build_settings['OTHER_SWIFT_FLAGS'] << '-no-verify-emitted-module-interface'
                          
                        end
                      end
                      
                      react_native_post_install(installer, config[:reactNativePath], mac_catalyst_enabled: false)
                      
                      
                    end
end
